/*
 * @Description: 
 * @Version: 0.0
 * @Author: taosong
 * @Date: 2023-12-13 20:17:28
 * @LastEditors: taosong
 * @LastEditTime: 2023-12-13 20:19:58
 */
function People(name, age) {
  console.log('this', this)
  this.name = name
  this.age = age
}

People.prototype.eat = function (name) {
  console.log(this, this.name)
  return ''
}

function Son(name, age, sex) {
  People.call(this, name, age) // 借用构造函数继承
  this.sex = sex
}



Son.prototype = new People('xiaoming', 30) // 原型链继承
Son.prototype.constructor = Son

let son = new Son('小名', 20, '男')

console.log('son', son, son.eat())